<template>
  <div>
    <h1>{{ msg }}</h1>
    <h2>学生姓名：{{ name }}</h2>
    <h2>学生性别：{{ gender }}</h2>
    <h2>学校年龄：{{ dAge }}</h2>
    <button @click="dAge++">年龄+1</button>
  </div>
</template>

<script>
export default {
  name: "Student",
  data() {
    return {
      msg: "Hello, world!",
      dAge: this.age
      // name: "张三",
      // gender: "男",
      // age: 18
    }
  },
  // props: ["name", "gender", "age"], // 简单接收

  // 限定传入参数的类型
  /*props:{
    name:String,
    age:Number,
    gender:String
  },*/
  props: {
    name: {
      type: String,
      required: true
    },
    gender: {
      type: String,
      required: true
    },
    age: {
      type: Number,
      default: 18
    },
  },
  computed: {},
  components: {},
  methods: {},
  watch: {},
  filters: {},
  directives: {}
}
</script>

<style scoped>

</style>